import request from '@/utils/request'

// 查询资讯管理列表
export function listArticle(query) {
  return request({
    url: '/article/article/list',
    method: 'get',
    params: query
  })
}

// 查询资讯管理详细
export function getArticle(articleId) {
  return request({
    url: '/article/article/' + articleId,
    method: 'get'
  })
}

// 新增资讯管理
export function addArticle(data) {
  return request({
    url: '/article/article',
    method: 'post',
    data: data
  })
}

// 修改资讯管理
export function updateArticle(data) {
  return request({
    url: '/article/article',
    method: 'put',
    data: data
  })
}

// 删除资讯管理
export function delArticle(articleId) {
  return request({
    url: '/article/article/' + articleId,
    method: 'delete'
  })
}

// 查询所有栏目
export function getCategories() {
  return request({
    url: '/article/article/categories',
    method: 'get'
  })
}

// 置顶/取消置顶
export function toggleTop(articleId) {
  return request({
    url: '/article/article/toggleTop/' + articleId,
    method: 'put'
  })
}

// 发布/下架操作
export function toggleStatus(articleId) {
  return request({
    url: '/article/article/toggleStatus/' + articleId,
    method: 'put'
  })
}

